28. CODE: Store the Board using the State Enum
Store the Board Using the State Enum
0 ⛰️ 0 0 0 0
0 ⛰️ 0 0 0 0
0 ⛰️ 0 0 0 0
0 ⛰️ 0 0 0 0
0 0 0 0 ⛰️ 0
Fantastic work! Now that you have a way to print the State
enum
values, you will be able to modify your program to use State
values in the board exclusively. To do this, you will need to modify the return types and variable types in several places of the code. Don't worry, as we have clearly marked these with a TODO
in each part of the code.
After this exercise, you will have completed the first part of this lesson, and you will begin coding the main A* search algorithm!
To Complete this Exercise:
Follow the
TODO
comments in themain
file below, and update the program to store a board ofState
variables. When you are done, the board should print as in the image above. Note that you will need to callCellString
on each object in the board before printing:CellString(board[i][j])
.
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity, so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: generic
- Opened files (when workspace is loaded): n/a
-
userCode:
export CXX=g++-7
export CXXFLAGS=-std=c++17
g++() {
/usr/bin/g++-7 -std=c++17 "$1"
}
export -f g++